package com.stellar.pay.config;

import com.stellar.pay.core.service.IPaymentNotifyHandler;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.math.BigDecimal;

@Configuration
public class WxPayAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public IPaymentNotifyHandler defaultPaymentNotifyHandler() {
        return new IPaymentNotifyHandler() {
            @Override
            public void handlePaymentSuccess(String orderNo, String transactionId, BigDecimal amount, String successTime, String tradeType,  Object object) {
                throw new IllegalStateException("未实现支付成功处理器");
            }

            @Override
            public boolean checkOrder(String orderNo) {
                throw new IllegalStateException("未实现校验订单处理器");
            }
        };
    }
}